package pl.smath.worksheet;

import junit.framework.TestCase;
import pl.smath.worksheet.results.Resolution;

public class SimplifyWorksheetTestCase extends TestCase{

	/** 
	 * Test data. Format:
	 * input => expected output 
	 */
	private static final String[][] testData = {
		{"3*x^2+2*x^2", "4*x^2"},
//		{"2*x+3*6*x^2+2*x^2-3*x"},
//		{"(3*x)^2+(2*x)^2"},
//		{"x^4+3*x^3+x^2-x-(x^3-2*x^2-x)"},
//		{"(x+2)*(x+3)-5*(x-2)"},
//		{"(x^2+3*x+2)*(x^2-3*x+2)"}
	};
	
	
	/**
	 * @param args
	 */
	public void testBasic() {
		
		Worksheet 	worksheet = new SimplifyWorksheet();
		Resolution	resolution;

		for(int i = 0; i < testData.length; i++){
			
			resolution = worksheet.process( testData[i][0] );

			assertEquals("Ilość krokow " + testData[i][0], testData[i].length, resolution.size());
			
			for(int j = 0; j < testData[i].length; j++){
				assertEquals(testData[i][0], testData[i][j], resolution.next());
			}
		}
	}

}
